package com.amizah.tooling.utils.console;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class WindowsConsole implements IConsole {

	public WindowsConsole()
	{
		
	}
	
	@Override
	public void write(String data) {
		
		System.out.println(data);

	}

	@Override
	public void write(Double data) {
		
		System.out.println(data);

	}

	@Override
	public void write(Float data) {
		
		System.out.println(data);

	}

	@Override
	public void write(Integer data) {
		
		System.out.println(data);
	}
	
	@Override
	public void write(Boolean data) {
		
		System.out.println(data);
	}

	@Override
	public String readString() {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    String data = null;
	    try {
			while ((data = in.readLine()) != null && data.length() != 0)
			  System.out.println(data);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return data;
	}

	@Override
	public Integer readInt() {
	
		Integer data = null;
          		
		try {
			System.in.read();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return data;
	}

	@Override
	public Double readDouble() {
	
		Double data = null;
          		
		try {
			System.in.read();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return data;
	}

	@Override
	public void newLine() {
		
		System.out.println("\n");
	}

}
